package com.byxy.service.impl;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.byxy.dao.UserDao;
import com.byxy.entity.User;
import com.byxy.service.UserService;

@Service
@Transactional
public class UserServiceImpl implements UserService {

	@Resource
	private UserDao userDao;

	@Override
	public User login(User u) {

		User user = userDao.getName(u.getLogin());
		System.out.println(user + "userservice");
		if (user != null && user.getLogin().equals(u.getLogin()) && user.getPass().equals(u.getPass())) {
			return user;
		}
		return null;
	}

	@Override
	public User getUser(Integer id) {
		return userDao.getId(id);
	}

}
